package com.acme.task1;

public class Calculator {
	public static void main(String[] args) {
		if(args.length != 3){
			System.out.println("It must be 3 arguments! ");
		}
		
		double operand1 = 0;
		double operand2 = 0;
		
		try {
			operand1 = Double.parseDouble(args[0]);
			operand2 = Double.parseDouble(args[2]);
		}
		catch (NumberFormatException ex) {
			System.out.print("Error in args number format. " + ex.getMessage() + "\n");
		}
		
		char operator = args[1].charAt(0);		
		switch(operator){
			case '+':
				System.out.println(operand1 + operand2);
				break;
			case '-':
				System.out.println(operand1 - operand2);
				break;
			case '*':
				System.out.println(operand1 * operand2);
				break;
			case 'x':
				System.out.println(operand1 * operand2);
				break;
			case '/':
				System.out.println(operand1 / operand2);
				break;
		}
	}
}